home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: thinkage.on.ca!atbowler
- From: atbowler@thinkage.on.ca (Alan Bowler)
- Subject: Re: pseudo-random numbers
- Message-ID: <DLE110.Ixp@thinkage.on.ca>
- Sender: news@thinkage.on.ca
- Organization: Thinkage Ltd.
- References: <17709D420S86.JJSTEP00@ukcc.uky.edu> <4d3ijv$9fl@news.iag.net>
- Date: Thu, 18 Jan 1996 17:38:59 GMT
-
- In article <4d3ijv$9fl@news.iag.net> jatmon@iag.net (John R Buchan) writes:
- >
- >One solution, suggested in the faq <polite jab>, is:
- >
- > (int)((double)rand() / ((double)RAND_MAX + 1) * N)
- ^
-
- Minor point. You have a typo. That should be
-
- (int)((double)rand() / ((double)RAND_MAX + 1) / N)
-